Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add code testing #585

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

heyAyushh
Copy link
Contributor

Problem

This PR introduces testing for snippets imported in markdown using code-import.

Summary of Changes

  • Seperated code files for cookbook wallet section
  • setup pnpm workspace
  • turborepo monorepo (in case code folder grows with multiple projects (react testing, mobile testing etc))
  • added tests with node:test
  • added GitHub Actions for testing only changed scripts on PR and all tests on schedule

Fixes #

  • Bug in code-import where It failed when line ranges weren't mentioned

@heyAyushh heyAyushh requested a review from nickfrosty as a code owner October 25, 2024 00:44
@ZYJLiu
Copy link
Collaborator

ZYJLiu commented Oct 25, 2024

Can you provide more context on the changes and instructions for how I can test your changes locally? Please include the commands to run.
Is turbo supposed to be included as a dev dependency?

When I ran turbo test I got the following error:

turbo 2.2.3

• Packages in scope: solana-developer-content-api, solana-developer-content-code
• Running test in 2 packages
• Remote caching disabled
solana-developer-content-api:build: cache miss, executing 1cb178dcc001b143
solana-developer-content-code:test: cache miss, executing f6823e566d70ef4f
solana-developer-content-api:build: 
solana-developer-content-code:test: 
solana-developer-content-api:build: 
solana-developer-content-api:build: > [email protected] build /developer-content
solana-developer-content-api:build: > pnpm code-import && pnpm prettier:i18n && pnpm contentlayer:build && next build
solana-developer-content-api:build: 
solana-developer-content-code:test: 
solana-developer-content-code:test: > [email protected] test /developer-content/code
solana-developer-content-code:test: > node --import tsx --test '**/*.test.ts' --trace-deprecation
solana-developer-content-code:test: 
solana-developer-content-code:test: Could not find '/developer-content/code/**/*.test.ts'
solana-developer-content-code:test:  ELIFECYCLE  Test failed. See above for more details.
solana-developer-content-code:test: ERROR: command finished with error: command (/developer-content/code) /usr/local/bin/pnpm run test exited (1)
solana-developer-content-code#test: command (/developer-content/code) /usr/local/bin/pnpm run test exited (1)

 Tasks:    0 successful, 2 total
Cached:    0 cached, 2 total
  Time:    383ms 
Failed:    solana-developer-content-code#test

 ERROR  run failed: command  exited (1)

Also the following error if I run pnpm run test in the new /code folder.

> [email protected] test /developer-content/code
> node --import tsx --test '**/*.test.ts' --trace-deprecation

Could not find '/developer-content/code/**/*.test.ts'
 ELIFECYCLE  Test failed. See above for more details.
 ```

@heyAyushh
Copy link
Contributor Author

Can you provide more context on the changes and instructions for how I can test your changes locally? Please include the commands to run. Is turbo supposed to be included as a dev dependency?

When I ran turbo test I got the following error:

turbo 2.2.3

• Packages in scope: solana-developer-content-api, solana-developer-content-code
• Running test in 2 packages
• Remote caching disabled
solana-developer-content-api:build: cache miss, executing 1cb178dcc001b143
solana-developer-content-code:test: cache miss, executing f6823e566d70ef4f
solana-developer-content-api:build: 
solana-developer-content-code:test: 
solana-developer-content-api:build: 
solana-developer-content-api:build: > [email protected] build /developer-content
solana-developer-content-api:build: > pnpm code-import && pnpm prettier:i18n && pnpm contentlayer:build && next build
solana-developer-content-api:build: 
solana-developer-content-code:test: 
solana-developer-content-code:test: > [email protected] test /developer-content/code
solana-developer-content-code:test: > node --import tsx --test '**/*.test.ts' --trace-deprecation
solana-developer-content-code:test: 
solana-developer-content-code:test: Could not find '/developer-content/code/**/*.test.ts'
solana-developer-content-code:test:  ELIFECYCLE  Test failed. See above for more details.
solana-developer-content-code:test: ERROR: command finished with error: command (/developer-content/code) /usr/local/bin/pnpm run test exited (1)
solana-developer-content-code#test: command (/developer-content/code) /usr/local/bin/pnpm run test exited (1)

 Tasks:    0 successful, 2 total
Cached:    0 cached, 2 total
  Time:    383ms 
Failed:    solana-developer-content-code#test

 ERROR  run failed: command  exited (1)

Also the following error if I run pnpm run test in the new /code folder.

> [email protected] test /developer-content/code
> node --import tsx --test '**/*.test.ts' --trace-deprecation

Could not find '/developer-content/code/**/*.test.ts'
 ELIFECYCLE  Test failed. See above for more details.
 ```

I added a testing section in Contibuting.md

   pnpm install
   cd code
   pnpm turbo test

let me know if this command doesn't work.

@heyAyushh
Copy link
Contributor Author

This PR resolves the issue where code path was shown on the block as name.

solana-foundation/solana-com#96

Copy link

github-actions bot commented Dec 9, 2024

This pull request has been automatically marked as stale because it has not had recent activity. Remove stale label or comment or this will be closed in 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants